package com.edu.hre.struts.form.survey;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.apache.struts.action.ActionForm;
import org.apache.struts.util.LabelValueBean;

import com.edu.hre.common.utils.CommonUtils;
import com.edu.hre.db.pojo.HreSubunit;

public class SurveyManagementUpdateForm extends ActionForm {

	/**
	 * 
	 */
	private static final long serialVersionUID = -3756275627644291738L;

	private Integer id;
	private String name;
	private int subunitId;
	private String subunit;
	private Date startDate;
	private Date endDate;
	private int userCreated;
	private String user;
	private Date dateCreated;
	private Date dateModified;
	private boolean showToAll;

	List<LabelValueBean> listSubunit = new ArrayList<LabelValueBean>();
	private boolean isSelected;
	private String method = "add";
	private String html = "";
	private String areaTopic= "";
	private boolean alowUpdate = true; // het han, hoac da co nguoi take
	private boolean alowAccessByUserCreated = false; // nguoi tao khong muon cac user khac chinh sua hoac xoa
	private int countUserTaken = 0;

	public SurveyManagementUpdateForm() {
	} 
	
	public SurveyManagementUpdateForm(Integer id, String name, int subunitId, String subunit, Date startDate, Date endDate, int userCreated, String user,
			Date dateCreated, Date dateModified) {
		super();
		this.id = id;
		this.name = name;
		this.subunitId = subunitId;
		this.subunit = subunit;
		this.startDate = startDate;
		this.endDate = endDate;
		this.userCreated = userCreated;
		this.user = user;
		this.dateCreated = dateCreated;
		this.dateModified = dateModified;
	} 
 
	
	public List<LabelValueBean> getListSubunit() {
		return listSubunit;
	}

	public void setListSubunit(List<LabelValueBean> listSubunit) {
		this.listSubunit = listSubunit;
	}

	public String getSubunit() {
		return subunit;
	}

	public void setSubunit(String subunit) {
		this.subunit = subunit;
	}

	public String getUser() {
		return user;
	}

	public void setUser(String user) {
		this.user = user;
	}

	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getSubunitId() {
		return this.subunitId;
	}

	public void setSubunitId(int subunitId) {
		this.subunitId = subunitId;
	}

	public Date getStartDate() {
		return this.startDate;
	}

	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

	public Date getEndDate() {
		return this.endDate;
	}

	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

	public int getUserCreated() {
		return this.userCreated;
	}

	public void setUserCreated(int userCreated) {
		this.userCreated = userCreated;
	}

	public Date getDateCreated() {
		return this.dateCreated;
	}

	public void setDateCreated(Date dateCreated) {
		this.dateCreated = dateCreated;
	}

	public Date getDateModified() {
		return this.dateModified;
	}

	public void setDateModified(Date dateModified) {
		this.dateModified = dateModified;
	}

	public boolean isSelected() {
		return isSelected;
	}

	public void setSelected(boolean isSelected) {
		this.isSelected = isSelected;
	}
	
	public boolean getIsSelected() {
		return isSelected;
	}

	public void setIsSelected(boolean isSelected) {
		this.isSelected = isSelected;
	}

	
	//private static final SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm");
	private static final SimpleDateFormat dateFormat2 = new SimpleDateFormat("MM/dd/yyyy");
	public String getStartDateStr() {
		try {
			return dateFormat2.format(startDate);
		} catch (Exception e) {
			return "";
		}
	}

	public void setStartDateStr(String startDate) {
		try {
			this.startDate = dateFormat2.parse(startDate);
		} catch (Exception e) {
			CommonUtils.println(e.getMessage());
		}
	}

	public String getEndDateStr() {
		try {
			return dateFormat2.format(endDate);
		} catch (Exception e) {
			CommonUtils.println(e.getMessage());
			return "";
		}
	}

	public void setEndDateStr(String endDate) {
		try {
			this.endDate = dateFormat2.parse(endDate);
		} catch (Exception e) {
			CommonUtils.println(e.getMessage());
		}
	} 

	public String getHtml() {
		return html;
	}

	public void setHtml(String html) {
		this.html = html;
	}

	public String getAreaTopic() {
		return areaTopic;
	}

	public void setAreaTopic(String areaTopic) {
		this.areaTopic = areaTopic;
	}

	public boolean getAlowUpdate() {
		return alowUpdate;
	}

	public void setAlowUpdate(boolean alowUpdate) {
		this.alowUpdate = alowUpdate;
	}

	public boolean getShowToAll() {
		return showToAll;
	}

	public void setShowToAll(boolean showToAll) {
		this.showToAll = showToAll;
	}
 
	public String getMethod() {
		return method;
	}

	public void setMethod(String method) {
		this.method = method;
	}

	public boolean getAlowAccessByUserCreated() {
		return alowAccessByUserCreated;
	}

	public void setAlowAccessByUserCreated(boolean alowAccessByUserCreated) {
		this.alowAccessByUserCreated = alowAccessByUserCreated;
	}

	public int getCountUserTaken() {
		return countUserTaken;
	}

	public void setCountUserTaken(int countUserTaken) {
		this.countUserTaken = countUserTaken;
	}
	
	
}
